﻿using System.Collections.Generic;

namespace JNPF.Basics.Models.WorkFlow.Model
{
    public class ChildNodeModelList
    {
        public string taskNodeId { get; set; }
        public string taskId { get; set; }
        public string type { get; set; }
        public string title { get; set; }
        private List<string> _approvers = new List<string>();
        public List<string> approvers
        {
            get { return this._approvers; }
            set { this._approvers = value; }
        }
        private List<string> _approverPos = new List<string>();
        public List<string> approverPos
        {
            get { return this._approverPos; }
            set { this._approverPos = value; }
        }
        public int? assigneeType { get; set; }
        private List<string> _circulatePosition = new List<string>();
        public List<string> circulatePosition
        {
            get { return this._circulatePosition; }
            set { this._circulatePosition = value; }
        }
        private List<string> _circulateUser = new List<string>();
        public List<string> circulateUser
        {
            get { return this._circulateUser; }
            set { this._circulateUser = value; }
        }
        public string progress { get; set; }
        public string rejectStep { get; set; }
        public string description { get; set; }
        public string nodeId { get; set; }
        public string prevId { get; set; }
        private List<FormOperatesModel> _formOperates = new List<FormOperatesModel>();
        public List<FormOperatesModel> formOperates
        {
            get { return this._formOperates; }
            set { this._formOperates = value; }
        }
        public string num { get; set; }
        public bool child { get; set; }
        public string childNode { get; set; }
        public string firstId { get; set; }
        //开始事件
        public bool hasInitfunc { get; set; }
        public string initInterfaceUrl { get; set; }
        public string initInterfaceType { get; set; }
        //结束事件
        public bool hasEndfunc { get; set; }
        public string endInterfaceUrl { get; set; }
        public string endInterfaceType { get; set; }
        //节点事件
        public bool hasApproverfunc { get; set; }
        public string approverInterfaceUrl { get; set; }
        public string approverInterfaceType { get; set; }
    }
    public class ChildNodeModel
    {
        public string type { get; set; }
        public string content { get; set; }
        public ChildNodeProperModel properties { get; set; }
        public string nodeId { get; set; }
        public string prevId { get; set; }
        public List<ChildCondModel> conditionNodes { get; set; }
        public ChildNodeModel childNode { get; set; }
    }

    public class ChildNodeProperModel
    {
        public string title { get; set; }
        public List<string> approvers { get; set; }//批准人
        public List<string> approverPos { get; set; }//批准部门
        public int? assigneeType { get; set; }
        public List<FormOperatesModel> formOperates { get; set; }//字段
        public List<string> circulatePosition { get; set; }//传阅人
        public List<string> circulateUser { get; set; }//传阅部门
        public string progress { get; set; }
        public string rejectStep { get; set; }
        public string description { get; set; }
        //开始事件
        public bool hasInitfunc { get; set; }
        public string initInterfaceUrl { get; set; }
        public string initInterfaceType { get; set; }
        //结束事件
        public bool hasEndfunc { get; set; }
        public string endInterfaceUrl { get; set; }
        public string endInterfaceType { get; set; }
        //节点事件
        public bool hasApproverfunc { get; set; }
        public string approverInterfaceUrl { get; set; }
        public string approverInterfaceType { get; set; }

        public bool isDefault { get; set; }
    }

    public class ChildCondModel
    {
        /**
         * type : condition
         * content : [流程主键 >= 12] 并且
         [流程主键 > 22] 或者
         [申请人 > 2122121]
         * properties : {"title":"条件1","conditions":[{"fieldName":"流程主键","symbolName":"大于等于","filedValue":"12","logicName":"并且","field":"F_FlowId","symbol":">=","logic":"&&"},{"fieldName":"流程主键","symbolName":"大于","filedValue":"22","logicName":"或者","field":"F_FlowId","symbol":">","logic":"||"},{"fieldName":"申请人","symbolName":"大于","filedValue":"2122121","logicName":"并且","field":"F_ApplyUser","symbol":">","logic":"&&"}],"initiator":null,"priority":0}
         * nodeId : Lb2
         * prevId : Kb2
         */

        public string type { get; set; }
        public string content { get; set; }
        public CondProperModel properties { get; set; }
        public string nodeId { get; set; }
        public string prevId { get; set; }
        public ChildNodeModel childNode { get; set; }
        public List<ChildCondModel> conditionNodes { get; set; }
    }

    public class CondProperModel
    {
        /**
         * title : 条件1
         * conditions : [{"fieldName":"流程主键","symbolName":"大于等于","filedValue":"12","logicName":"并且","field":"F_FlowId","symbol":">=","logic":"&&"},{"fieldName":"流程主键","symbolName":"大于","filedValue":"22","logicName":"或者","field":"F_FlowId","symbol":">","logic":"||"},{"fieldName":"申请人","symbolName":"大于","filedValue":"2122121","logicName":"并且","field":"F_ApplyUser","symbol":">","logic":"&&"}]
         * initiator : null
         * priority : 0
         */

        public string title { get; set; }
        public string initiator { get; set; }
        public int priority { get; set; }
        public List<ProperCondModel> conditions { get; set; }
        public bool isDefault { get; set; }
    }

    public class FormOperatesModel
    {
        public bool read { get; set; }
        public string name { get; set; }
        public string id;
        public bool write { get; set; }
    }
    public class ConditionList
    {
        public List<ProperCondModel> conditions { get; set; }
        public string nodeId { get; set; }
        public string prevId { get; set; }
        public bool child { get; set; }
        public string childNodeId { get; set; }
        public string firstId { get; set; }
        public bool isDefault { get; set; }
    }

    public class ConditionModel
    {
        public string field { get; set; }
        public string fieldName { get; set; }
        public string filedValue { get; set; }
        public string symbol { get; set; }
        public string logic { get; set; }
    }
    public class ProperCondModel
    {
        /**
         * fieldName : 流程主键
         * symbolName : 大于等于
         * filedValue : 12
         * logicName : 并且
         * field : F_FlowId
         * symbol : >=
         * logic : &&
         */
        public string fieldName { get; set; }
        public string symbolName { get; set; }
        public string filedValue { get; set; }
        public string logicName { get; set; }
        public string field { get; set; }
        public string symbol { get; set; }
        public string logic { get; set; }
    }
}
